#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <DataCore/sim_data.h>
#include <string>
using namespace PhysLeo;
namespace py = pybind11;


template<typename T>
static void declareSimData(py::module &mod, const std::string &typestr)
{
	using class_type = SimData<T>;
	auto pyclass_name = std::string("SimData") + typestr;
	py::class_<class_type, std::shared_ptr<class_type>>cls_sim_data(mod, pyclass_name.c_str());

    cls_sim_data.def(py::init());
    cls_sim_data.def_readwrite("rest_pos_", &class_type::ptr_rest_pos_);
    cls_sim_data.def_readwrite("pos_", &class_type::ptr_pos_);
    cls_sim_data.def_readwrite("ele_", &class_type::ptr_ele_);
    cls_sim_data.def_readwrite("vert_volume_", &class_type::ptr_vert_volume_);
    cls_sim_data.def_readwrite("ele_volume_", &class_type::ptr_ele_volume_);
    cls_sim_data.def_readwrite("vert_material_", &class_type::ptr_vert_material_);
    cls_sim_data.def_readwrite("ele_material_", &class_type::ptr_ele_material_);
    cls_sim_data.def_readwrite("mass_", &class_type::ptr_mass_);
    cls_sim_data.def_readwrite("vel_", &class_type::ptr_vel_);
    cls_sim_data.def_readwrite("force_", &class_type::ptr_force_);
    cls_sim_data.def_readwrite("fix_", &class_type::ptr_fix_);

    
    cls_sim_data.def_readonly("homogeneous_", &class_type::homogeneous_);
    cls_sim_data.def_readwrite("velocity_damping_param_", &class_type::velocity_damping_param_);
    cls_sim_data.def_readwrite("gravity_acceleration_", &class_type::gravity_acceleration_);
    cls_sim_data.def_readonly("ele_type_", &class_type::ele_type_);
    cls_sim_data.def_readonly("fem_material_type_", &class_type::fem_material_type_);
    cls_sim_data.def_readonly("quadrature_points_", &class_type::quadrature_points_);
    cls_sim_data.def_readonly("horizon_radius_", &class_type::horizon_radius_);
    cls_sim_data.def_readonly("pdm_material_type_", &class_type::pdm_material_type_);
    cls_sim_data.def_readonly("pdm_invertible_", &class_type::pdm_invertible_);
    cls_sim_data.def_readonly("pdm_weight_type_", &class_type::pdm_weight_type_);

    cls_sim_data.def("readGeometry", &class_type::readGeometry);
    cls_sim_data.def("readSimulationConfig", &class_type::readSimulationConfig);
}

void initSimData(py::module &m)
{
	declareSimData<float>(m, std::string("F"));
	declareSimData<double>(m, std::string("D"));
}
